<?php require VIEW_PATH."/header.php";?>
<body>
    <link rel="stylesheet" href="Public/org/kindeditor/themes/default/default.css" />
    <script src="Public/org/kindeditor/kindeditor.js"></script>
    <script src="Public/org/kindeditor/lang/zh_CN.js"></script>
    <script src="{{__VIEW__}}/Goods/js.js"></script>
    <link rel="stylesheet" href="{{__VIEW__}}/Goods/css.css" />
    <form method="post" enctype="multipart/form-data">

        <input type="hidden" name="goods_id" value="{{$field['goods_id']}}">
        <div class="hd-tab">
            <ul class="hd-tab-menu">
                <li lab="base" class="active">
                    <a> 基本设置 </a>
                </li>
                <li lab="pics">
                    <a> 商品图集 </a>
                </li>
                <li lab="attribute">
                    <a> 商品属性 </a>
                </li>
                <li lab="service">
                    <a> 商品详情 </a>
                </li>
            </ul>
            <div class="hd-tab-content">
                <div lab="base" class="hd-tab-area">
                    <table class="hd-form hd-table hd-table-form">
                        <thead>
                            <tr>
                                <td colspan="2">添加商品</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th>栏目</th>
                                <td>
                                    <select name="cat_id">
                                        {{foreach from="$catData" value="$v"}}
                                        <option value="{{$v['cat_id']}}"
                                        {{if value="$v['cat_id']==$field['cat_id']"}}
                                        selected
                                        {{endif}}
                                        >{{$v['_cat_name']}}</option>
                                        {{endforeach}}
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th>商品名称</th>
                                <td>
                                    <input type="text" name="goods_name" value="{{$field['goods_name']}}" class="hd-w300">
                                </td>
                            </tr>
                            <tr>
                                <th>货号</th>
                                <td>
                                    <input type="text" name="goods_sn" value="{{$field['goods_sn']}}" class="hd-w300">
                                </td>
                            </tr>
                            <tr>
                              <th>商城价</th>
                              <td>
                                <input type="text" name="shop_price" value="{{$field['shop_price']}}" class="hd-w300">
                            </td>
                        </tr>
                        <tr>
                          <th>市场价</th>
                          <td>
                            <input type="text" name="market_price" value="{{$field['market_price']}}" class="hd-w300">
                        </td>
                    </tr>
                    <tr>
                        <th>单位</th>
                        <td>
                            <input type="text" name="unit" value="{{$field['unit']}}" class="hd-w300">
                        </td>
                    </tr>
                    <tr>
                        <th>品牌</th>
                        <td>
                            <select name="brand_id">
                                {{foreach from="$brandData" value="$v"}}
                                <option value="{{$v['id']}}"
                                {{if value="$v['id']==$field['brand_id']"}}
                                selected
                                {{endif}}
                                >{{$v['name']}}</option>
                                {{endforeach}}
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>点击数</th>
                        <td>
                            <input type="text" name="click" value="{{$field['click']}}" class="hd-w300">
                        </td>
                    </tr>
                    <tr>
                        <th>列表页图</th>
                        <td>
                            {{if value="$field['list_pic']"}}
                            <img src="{{$field['list_pic']}}" style="width:50px;vertical-align: middle">
                            <input type="hidden" name="list_pic" value="{{$field['list_pic']}}">
                            {{endif}}
                            <input type="file" name="list_pic" class="hd-w300">
                        </td>
                    </tr>
                    <tr>
                        <th>缩略图</th>
                        <td>
                           {{if value="$field['thumb_pic']"}}
                           <img src="{{$field['thumb_pic']}}" style="width:50px;vertical-align: middle">
                           <input type="hidden" name="thumb_pic" value="{{$field['thumb_pic']}}">
                           {{endif}}
                           <input type="file" name="thumb_pic" class="hd-w300">
                       </td>
                   </tr>
                   <tr>
                    <th>栏目关键词</th>
                    <td>
                        <input type="text" name="keyword" value="{{$field['keyword']}}" class="hd-w300">
                    </td>
                </tr>
                <tr>
                    <th>栏目描述</th>
                    <td>
                        <textarea name="description" class="hd-w300 hd-h100"></textarea>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div lab="pics" class="hd-tab-area">
        <ul class="picsList">
            {{foreach from = "$pics" value = "$p"}}
            <li id="pic{{$p['id']}}">
                <img src="{{$p['small_pic']}}" style="width:100px;">
                <span onclick="delPic({{$p['id']}})">X</span>
            </li>
            {{endforeach}}
        </ul>
        <table id="pics">
            <tr>
                <td>
                    <input type="file" name="pics[]" ><span onclick="addPic(this)">[+]</span>
                </td>
            </tr>
        </table>
    </div>
    <div lab="attribute" class="hd-tab-area">

        <section>
            &nbsp;&nbsp;&nbsp;&nbsp;选择类型:
            <select name="type_id" id="type_id"  onchange="getAttrList({{$field['goods_id']}})" style="margin: 20px 0 20px 10px;border: 1px solid #333;" >
                <option value="">===选择类型===</option>
                {{foreach from="$shopType" value="$v"}}
                <option value="{{$v['id']}}"
                {{if value="$field['type_id']==$v['id']" }}
                selected
                {{endif}}
                >{{$v['type_name']}}</option>
                {{endforeach}}
            </select>
        </section>
        <section style="min-height: 300px;">
            <table id="attr_list" class="hd-table hd-table-form hd-form">
                <thead>
                    <tr>
                        <th width="15%">属性</th>
                        <td width="20%">属性值</td>
                        <td width="">加价</td>
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </section>



    </div>
    <div lab="service" class="hd-tab-area">
        <table class="hd-table hd-table-form hd-form">
            <tr>
                <th class="hd-w100">商品详情</th>
                <td>
                    <textarea name="content" id="content" style="width:700px;height:300px;">{{$field['content']}}</textarea>
                    <script type="text/javascript">
                        KindEditor.ready(function(K) {
                            window.editor = K.create('#content');
                        });
                    </script>
                </td>
            </tr>
            <tr>
                <th class="hd-w100">售后服务</th>
                <td>
                    <textarea name="service" id="service" style="width:700px;height:300px;">{{$field['service']}}</textarea>
                    <script type="text/javascript">
                        KindEditor.ready(function(K) {
                            window.editor = K.create('#service');
                        });
                    </script>
                </td>
            </tr>

        </table>
    </div>
</div>
<button class="hd-btn hd-btn-primary">提交</button>
<button type="button" onclick="location.href ='<?php echo __HISTORY__;?>'" class="hd-btn hd-btn-default">返回</button>
</div>
</form>
<script type="text/javascript">

    $(function(){
        getAttrList({{$field['goods_id']}});
    })
</script>
</body>
</html>